function useStorage(key){
    const setStorage=(value)=>{
      if(typeof value==="object"){
        localStorage.setItem(key,JSON.stringify(value))
      }else{
        localStorage.setItem(key,value)
      }
    }
    const removeStorage=()=>{
        localStorage.removeItem(key)
    }
    const getStorage=()=>{
      try {
         let value=JSON.parse(localStorage.getItem(key))
         return value
      } catch (error) {
         return localStorage.getItem(key)
      }
    }
    return [setStorage,removeStorage,getStorage]
}
export default useStorage